xen: sched: on credit2, don't reprogram the timer if idle
authorDario Faggioli <dario.faggioli@citrix.com>
Fri, 18 Mar 2016 17:32:50 +0000 (18:32 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 8 Apr 2016 15:00:33 +0000 (16:00 +0100)
As other schedulers are doing already: if the idle vcpu
is picked and scheduled, there is no need to reprogram the
scheduler timer to fire and invoke csched2_schedule()
again in future.

Tickling or external events will serve as pokes, when
necessary, but until we can, we should just stay idle.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reported-by: Tianyang Chen <tiche@seas.upenn.edu>
Suggested-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c

index 7286e5061be7e51e886c6232e1d3cd393d4276e4..b207d8491a2bcb03cf7d76bdbb1426676f021347 100644 (file)
@@ -1543,8 +1543,12 @@ csched2_runtime(const struct scheduler *ops, int cpu, struct csched2_vcpu *snext
     struct csched2_runqueue_data *rqd = RQD(ops, cpu);
     struct list_head *runq = &rqd->runq;
 
+    /*
+     * If we're idle, just stay so. Others (or external events)
+     * will poke us when necessary.
+     */
     if ( is_idle_vcpu(snext->vcpu) )
-        return CSCHED2_MAX_TIMER;
+        return -1;
 
     /* General algorithm:
      * 1) Run until snext's credit will be 0